/**
* Copyright (c) 2012-2013 Nokia Corporation. All rights reserved.
* Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. 
* Oracle and Java are trademarks or registered trademarks of Oracle and/or its
* affiliates. Other product and company names mentioned herein may be trademarks
* or trade names of their respective owners. 
* See LICENSE.TXT for license information.
*/

package com.nokia.example.explonoid.effects;

import java.util.Vector;
import javax.microedition.lcdui.Graphics;

/**
 * Manages ShockWave objects by providing methods for creating and painting them.
 * <P>
 * For usage, see the Game class.
 * 
 * @see com.nokia.example.explonoid.game.Game
 */
public class ShockWaveManager {

    private Vector shockWaves = new Vector();

    public void paint(Graphics g) {
        for (int i = shockWaves.size() - 1; i >= 0; i--) {
            ShockWave e = (ShockWave) shockWaves.elementAt(i);
            if (!e.paint(g)) {
                shockWaves.removeElementAt(i);
            }
        }
    }

    public void createShockWave(int x, int y, int size, int frames) {
        shockWaves.addElement(new ShockWave(x, y, size, frames));
    }
}
